<%DIRECTIVE DYNAMIC;%>

<style type="text/css">
/* 图片上传样式 */
.weui_uploader_input {
	position: absolute;
	z-index: 2;
	top: 30px;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	-webkit-tap-highlight-color: rgba(0, 0, 0, 0)
}
.weui_uploader_input_wrp {
	float: left;
	position: relative;
	margin-left: 50px;
	width: 70%;
	height: 110px;
	border: 1px solid #d9d9d9
}
.weui_uploader_input_wrp:after, .weui_uploader_input_wrp:before {
	content: " ";
	position: absolute;
	top: 50%;
	left: 50%;
	-webkit-transform: translate(-50%, -50%);
	transform: translate(-50%, -50%);
	background-color: #d9d9d9
}
.weui_uploader_input_wrp:before {
	width: 2px;
	height: 39.5px
}
.weui_uploader_input_wrp:after {
	width: 39.5px;
	height: 2px
}
.weui_uploader_input_wrp:active {
	border-color: #999
}
.weui_uploader_input_wrp:active:after, .weui_uploader_input_wrp:active:before
	{
	background-color: #999
}
</style>
<div class="content-wrap">
    <div class="wrapper" style="min-height:900px;min-width: 1000px;">
        <section class="panel panel-form">
        	<header class="panel-heading clearfix brtl brtr">
            	<div class="overflow-hidden">
                	<a href="javascript:;" class="h4 show no-m pt5">场地新增</a>
                </div>
            </header>
            <form id="addForm" role="form" class="form-horizontal parsley-form" data-parsley-validate
                  action="${base}/platform/fieldTrue/addDo" method="post">
                <input type="hidden" name="postcode" value="">
                <input type="hidden" name="pcode" value="">
                <input type="hidden" name="pname" value="">
                <input type="hidden" name="citycode" value="">
                <input type="hidden" name="cityname" value="">
                <input type="hidden" name="adcode" value="">
                <input type="hidden" name="adname" value="">
                <div class="row mb10">
                    <div class="col-lg-12">
                        <div class="form-group">
                            <label for="name" class="col-sm-2 control-label">名称</label>
                            <div class="col-sm-8">
                                <input type="text" id="name" value="" class="form-control" name="name"
                                       data-parsley-required="true" placeholder="名称">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="type" class="col-sm-2 control-label">类型</label>
                            <div class="col-sm-8">
                                <input type="text" id="type" class="form-control" name="type" data-parsley-required="true"
                                       placeholder="名称" value="">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="typecode" class="col-sm-2 control-label">类型编码</label>

                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="typecode" name="typecode" value="" data-parsley-required="true" placeholder="类型编码">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="tel" class="col-sm-2 control-label">电话</label>

                            <div class="col-sm-8">
                                <input type="text" id="tel" name="tel" value="" data-parsley-required="true"
                                       class="form-control" placeholder="电话">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="lng" class="col-sm-2 control-label">经度</label>

                            <div class="col-sm-8">
                                <input type="text" id="lng"  value="" data-parsley-required="true"
                                       class="form-control" placeholder="经度">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="lat" class="col-sm-2 control-label">纬度</label>

                            <div class="col-sm-8">
                                <input type="text" id="lat"  value="" data-parsley-required="true"
                                       class="form-control" placeholder="纬度">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="pca" class="col-sm-2 control-label">所属区域</label>

                            <div class="col-sm-8">
                                <input type="text" id="pca"  value="" 
                                       class="form-control" placeholder="所属区域">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-sm-2 control-label">地址</label>

                            <div class="col-sm-8">
                                <input type="text" id="address" name="address" value="" data-parsley-required="true"
                                       class="form-control" placeholder="地址">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row mb12">
					<div style="clear:both;margin:10px 0;" id="photoDiv"  class="col-sm-10">
					</div>
					<div id="btnUpload" style="margin-left: 116px; margin-top: 8px;" >
						<div class="weui_uploader_input_wrp">
							<input id="one" type="file" class="weui_uploader_input accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
						</div>
					</div>
	                <div style="margin-left: 250px;margin-right:250px;position: relative;">
	                    <div class="form-group text-center">
	                        <label></label>
	                        <div>
	                            <button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
	                        </div>
	                    </div>
	                </div>
	        	</div>
            </form>
        </section>

    </div>
</div>
<a class="exit-offscreen"></a>
<script language="JavaScript">
    $(function() { 
	   upload();
	});
	//图片上传
	var i = 0;
	function upload() {
		$('#one').change(
		function() {
			i++;
			var file = this.files[0];
			var r = new FileReader();
			r.readAsDataURL(file);
			$(r).load(function() {
			var html = '<div style="margin-left: 150px;">'+
						'<div style="float: left; width: 150px; height: 150px">'
						+ '<input type="hidden" name="title['+i+']"  value=""  />'
						+ '<input type="hidden" name="url['+i+']" value="'+ this.result.replace(",", ".")+ '" />'
						+ '<img alt="" src="'+this.result +'" style="width: 150px; height: 150px" >'
						+ '<span style="position: relative; left: 123px; top:-145px; z-index: 10;">'
						+ '<img src="${base!}/assets/img/del.png" onclick="delold(this)" style="width:20px;height: 20px"/>'
						+ '</span></div></div>';
						$("#photoDiv").append(html);
			})
		})
	}
  	//删除原有图片
	function delold(obj,id){
		var ids=$("#deleteIds").val();
		ids=ids+";"+id;
		$("#deleteIds").val(ids);
		jQuery(obj).parent().parent().remove();
	}
</script>
